home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / mus / misc / The_Player_6_0A.lha / Player6.0A / Source / 600.2_devpac3.asm < prev    next >
Assembly Source File  |  1994-01-22  |  36KB  |  2,382 lines

  1. * The Player 6.0A for DevPac 3 and later *
  2.  
  3. ;start = 6    ;Starting position
  4.  
  5. fade  = 0    ;0 = normal
  6.         ;1 = use master volume
  7.  
  8. system = 1    ;0 = killer
  9.         ;1 = friendly
  10.  
  11. CIA = system!1    ;0 = disabled
  12.         ;1 = enabled
  13.         ;System friendly version always CIA
  14.  
  15. exec = 1    ;0 = ExecBase destroyed
  16.         ;1 = ExecBase valid
  17.  
  18. lev6 = 1    ;0 = NonLev6
  19.         ;1 = Lev6 used
  20.  
  21. opt020 = 0    ;0 = MC680x0
  22.         ;1 = MC68020 or better
  23.  
  24. channels = 4    ;amount of channels to be played
  25.  
  26. use = -1    ;The Usecode
  27.  
  28.     incdir    include:
  29.     include Player6.i
  30.  
  31.     section    Player6.0A,code
  32.  
  33.     movem.l    d0-a6,-(sp)
  34.     lea    $dff000,a6
  35.     ifeq    system
  36.     move    $1c(a6),-(sp)
  37.     move    #$7fff,$9a(a6)
  38.     move    #$e000,$9a(a6)
  39.     move    2(a6),-(sp)
  40.     move    #$7ff,$96(a6)
  41.     endc
  42.  
  43.     lea    P60_data,a0    ;Module
  44.     sub.l    a1,a1        ;Samples
  45.     lea    samples,a2    ;Sample buffer
  46.     moveq    #0,d0        ;Auto Detect
  47.     bsr    P60_motuuli+P60_InitOffset
  48.  
  49.     tst    d0        ;Went ok?
  50.     bne    P60_exit
  51.  
  52. P60_sync
  53.     ifeq    CIA
  54.     move.l    4(a6),d0
  55.     andi.l    #$1ff00,d0
  56.     cmp.l    #$8100,d0
  57.     bne.b    P60_sync
  58.  
  59. P60_sync2
  60.     move.l    4(a6),d0
  61.     andi.l    #$1ff00,d0
  62.     cmp.l    #$8200,d0
  63.     bne.b    P60_sync2
  64.  
  65.     move    #$fff,$180(a6)
  66.     bsr    P60_motuuli+P60_MusicOffset
  67.     clr    $180(a6)
  68.  
  69.     moveq    #0,d0
  70.     move    6(a6),d0
  71.     sub.l    #$8200,d0
  72.     cmp.l    P60_raster(pc),d0
  73.     ble.b    P60_kosj
  74.     move    d0,P60_raster+2
  75. P60_kosj
  76.     tst    P60_raster2+2
  77.     bne.b    P60_doing
  78.     move    d0,P60_raster2+2
  79.     bra.b    P60_doneg
  80. P60_doing
  81.     add.l    P60_raster2(pc),d0
  82.     asr.l    #1,d0
  83.     move.l    d0,P60_raster2
  84. P60_doneg
  85.     addq.l    #1,P60_frames
  86.  
  87.     ifne    fade
  88.     btst    #10,$16(a6)
  89.     bne.b    P60_jid
  90.     move    P60_diri(pc),d0
  91.     sub    d0,P60_motuuli+P60_MasterVolume
  92.     bne.b    P60_judo
  93.     neg    P60_diri
  94.     bra.b    P60_jid
  95. P60_judo
  96.     cmp    #64,P60_motuuli+P60_MasterVolume
  97.     bne.b    P60_jid
  98.     neg    P60_diri
  99.     endc
  100.  
  101. P60_jid
  102.     endc
  103.  
  104.     btst    #6,$bfe001
  105.     bne    P60_sync
  106.  
  107. P60_exit
  108.     bsr    P60_motuuli+P60_EndOffset
  109.  
  110.     ifeq    system
  111.     move    (sp)+,d7
  112.     bset    #15,d7
  113.     move    #$7ff,$96(a6)
  114.     move    d7,$96(a6)
  115.  
  116.     move    (sp)+,d7
  117.     bset    #15,d7
  118.     move    #$7fff,$9a(a6)
  119.     move    d7,$9a(a6)
  120.     endc
  121.     movem.l    (sp)+,d0-a6
  122.  
  123.     move.l    P60_raster(pc),d0
  124.     move.l    P60_raster2(pc),d1
  125.     move.l    P60_frames(pc),d2
  126.     move.l    P60_positionbase(pc),a0
  127.     move.l    P60_patternbase(pc),a1
  128.     move.l    P60_spos(pc),a2
  129.     rts
  130.  
  131. P60_IRQsave    dc    0
  132. P60_DMAsave    dc    0
  133. P60_raster    dc.l    0
  134. P60_raster2    dc.l    0
  135. P60_frames    dc.l    0
  136. P60_diri    dc    1
  137.  
  138. *********************************
  139. *        Player 6.0A ®        *
  140. *   All in one-DevPac3-version    *
  141. *        Version 600.2        *
  142. *   © 1992-93 Jarno Paananen    *
  143. *     All rights reserved    *
  144. *********************************
  145.  
  146.  
  147. ******** START OF BINARY FILE **************
  148.  
  149. P60_motuuli
  150.     bra    P60_Init
  151.     ifeq    CIA
  152.     bra    P60_Music
  153.     else
  154.     rts
  155.     rts
  156.     endc
  157.     bra    P60_End
  158.     rts                ;no P60_SetRepeat
  159.     rts
  160.  
  161. P60_master    dc    64        ;Master volume (0-64)
  162. P60_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  163. P60_play    dc    1        ;Stop flag (0=stop)
  164. P60_E8        dc    0        ;Info nybble after command E8
  165.  
  166. P60_Temp0Offset
  167.     dc.l    P60_temp0-P60_motuuli
  168. P60_Temp1Offset
  169.     dc.l    P60_temp1-P60_motuuli
  170. P60_Temp2Offset
  171.     dc.l    P60_temp2-P60_motuuli
  172. P60_Temp3Offset
  173.     dc.l    P60_temp3-P60_motuuli
  174.  
  175. P60_getnote    macro
  176.     moveq    #$7e,d0
  177.     and.b    (a5),d0
  178.     beq.b    .nonote
  179.     ifne    P60_vib
  180.     clr.b    P60_VibPos(a5)
  181.     endc
  182.     ifne    P60_tre
  183.     clr.b    P60_TrePos(a5)
  184.     endc
  185.  
  186.     ifne    P60_ft
  187.     add    P60_Fine(a5),d0
  188.     endc
  189.     move    d0,P60_Note(a5)
  190.     move    (a2,d0),P60_Period(a5)
  191.  
  192. .nonote
  193.     endm
  194.  
  195.     ifne    CIA
  196.  
  197.     ifeq    system
  198. P60_intti
  199.     movem.l    d0-a6,-(sp)
  200.     tst.b    $bfdd00
  201.     move.b    #$7e,$bfdd00
  202.  
  203.     lea    $dff000,a6
  204. ;    move    #$fff,$180(a6)
  205.     bsr    P60_Music
  206. ;    move    #0,$180(a6)
  207.     move    #$2000,$9c(a6)
  208.     movem.l    (sp)+,d0-a6
  209.     rte
  210.  
  211.     else
  212. P60_lev6server
  213.     movem.l    d2-d7/a2-a6,-(sp)
  214.     lea    $dff000,a6
  215.     lea    P60_cn(pc),a3
  216.     move    P60_server(pc),d0
  217.     beq.b    P60_musica
  218.     subq    #1,d0
  219.     beq    P60_dmason
  220.     bra    P60_setrepeat
  221. P60_musica
  222.     bsr    P60_Music
  223. P60_ohi    movem.l    (sp)+,d2-d7/a2-a6
  224.     moveq    #1,d0
  225.     rts
  226.     endc
  227.     endc
  228.  
  229. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  230. ;­ Call P60_Init to initialize the playroutine    ­
  231. ;­ D0 --> Timer detection (for CIA-version)    ­
  232. ;­ A0 --> Address to the module            ­
  233. ;­ A1 --> Address to samples/0            ­
  234. ;­ A2 --> Address to sample buffer        ­
  235. ;­ D0 <-- 0 if succeeded            ­
  236. ;­ A6 <-- $DFF000                ­
  237. ;­         Uses D0-A6            ­
  238. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  239.  
  240. P60_Init
  241.     cmp.l    #"P60A",(a0)+
  242.     beq.b    .modok
  243.     subq.l    #4,a0
  244.  
  245. .modok    
  246.     ifne    CIA
  247.     move    d0,-(sp)
  248.     endc
  249.  
  250.     moveq    #0,d0
  251.     cmp.l    d0,a1
  252.     bne.b    .redirect
  253.  
  254.     move    (a0),d0
  255.     lea    (a0,d0.l),a1
  256. .redirect
  257.     move.l    a2,a6
  258.     lea    8(a0),a2
  259.     moveq    #$40,d0
  260.     and.b    3(a0),d0
  261.     bne.b    .buffer
  262.     move.l    a1,a6
  263.     subq.l    #4,a2
  264. .buffer
  265.  
  266.     lea    P60_cn(pc),a3
  267.     moveq    #$1f,d1
  268.     and.b    3(a0),d1
  269.     move.l    a0,-(sp)
  270.     lea    P60_Samples(pc),a4
  271.     subq    #1,d1
  272.     moveq    #0,d4
  273. P60_lopos
  274.     move.l    a6,(a4)+
  275.     move    (a2)+,d4
  276.     bpl.b    P60_kook
  277.     neg    d4
  278.     lea    P60_Samples-16(pc),a5
  279.     ifeq    opt020
  280.     asl    #4,d4
  281.     move.l    (a5,d4),d6
  282.     else
  283.     add    d4,d4
  284.     move.l    (a5,d4*8),d6
  285.     endc
  286.     move.l    d6,-4(a4)
  287.     move    4(a5,d4),d4
  288.     sub.l    d4,a6
  289.     sub.l    d4,a6
  290.     bra.b    P60_jatk
  291.  
  292. P60_kook
  293.     move.l    a6,d6
  294.     tst.b    3(a0)
  295.     bpl.b    P60_jatk
  296.  
  297.     move.l    d4,d0
  298.     subq.l    #2,d0
  299.     bmi.b    P60_jatk
  300.     move.l    a6,a5
  301.     move.b    (a5)+,d2
  302.     sub.b    (a5),d2
  303.     move.b    d2,(a5)+
  304. .loop    sub.b    (a5),d2
  305.     move.b    d2,(a5)+
  306.     sub.b    (a5),d2
  307.     move.b    d2,(a5)+
  308.     dbf    d0,.loop
  309.  
  310. P60_jatk
  311.     move    d4,(a4)+
  312.     moveq    #0,d2
  313.     move.b    (a2)+,d2
  314.     moveq    #0,d3
  315.     move.b    (a2)+,d3
  316.  
  317.     moveq    #0,d0
  318.     move    (a2)+,d0
  319.     bmi.b    .norepeat
  320.  
  321.     move    d4,d5
  322.     sub    d0,d5
  323.     move.l    d6,a5
  324.  
  325.     add.l    d0,a5
  326.     add.l    d0,a5
  327.  
  328.     move.l    a5,(a4)+
  329.     move    d5,(a4)+
  330.     bra.b    P60_gene
  331. .norepeat
  332.     move.l    d6,(a4)+
  333.     move    #1,(a4)+
  334. P60_gene
  335.     move    d3,(a4)+
  336.     moveq    #$f,d0
  337.     and    d2,d0
  338.     mulu    #74,d0
  339.     move    d0,(a4)+
  340.  
  341.     tst    -6(a2)
  342.     bmi.b    .nobuffer
  343.  
  344.     moveq    #$40,d0
  345.     and.b    3(a0),d0
  346.     beq.b    .nobuffer
  347.  
  348.     move    d4,d7
  349.     tst.b    d2
  350.     bpl.b    .copy
  351.  
  352.     subq    #1,d7
  353.     moveq    #0,d5
  354.     moveq    #0,d4
  355. .lo    move.b    (a1)+,d4
  356.     moveq    #$f,d3
  357.     and    d4,d3
  358.     lsr    #4,d4
  359.  
  360.     sub.b    .table(pc,d4),d5
  361.     move.b    d5,(a6)+
  362.     sub.b    .table(pc,d3),d5
  363.     move.b    d5,(a6)+
  364.     dbf    d7,.lo
  365.     bra.b    .kop
  366.  
  367. .copy    add    d7,d7
  368.     subq    #1,d7
  369. .cob    move.b    (a1)+,(a6)+
  370.     dbf    d7,.cob
  371.     bra.b    .kop
  372.  
  373. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  374.  
  375. .nobuffer
  376.     add.l    d4,a6
  377.     add.l    d4,a6
  378. .kop    dbf    d1,P60_lopos
  379.  
  380.     move.l    (sp)+,a0
  381.     and.b    #$7f,3(a0)
  382.  
  383.     move.l    a2,-(sp)
  384.  
  385.     lea    P60_temp0(pc),a1
  386.     lea    P60_temp1(pc),a2
  387.     lea    P60_temp2(pc),a4
  388.     lea    P60_temp3(pc),a5
  389.     moveq    #Channel_Block_SIZE/2-2,d0
  390.  
  391.     moveq    #0,d1
  392. .cl    move    d1,(a1)+
  393.     move    d1,(a2)+
  394.     move    d1,(a4)+
  395.     move    d1,(a5)+
  396.     dbf    d0,.cl
  397.  
  398.     move.l    (sp)+,a2
  399.     move.l    a2,P60_positionbase-P60_cn(a3)
  400.  
  401.     moveq    #$7f,d1
  402.     and.b    2(a0),d1
  403.  
  404.     ifeq    opt020
  405.     lsl    #3,d1
  406.     lea    (a2,d1.l),a4
  407.     else
  408.     lea    (a2,d1.l*8),a4
  409.     endc
  410.     move.l    a4,P60_possibase-P60_cn(a3)
  411.  
  412.     move.l    a4,a1
  413.     moveq    #-1,d0
  414. .search    cmp.b    (a1)+,d0
  415.     bne.b    .search
  416.     move.l    a1,P60_patternbase-P60_cn(a3)    
  417.  
  418.     ifd    start
  419.     lea    start(a4),a4
  420.     endc
  421.  
  422.     moveq    #0,d0
  423.     move.b    (a4)+,d0
  424.     move.l    a4,P60_spos-P60_cn(a3)
  425.     lsl    #3,d0
  426.     add.l    d0,a2
  427.  
  428.     move.l    a1,a4
  429.     moveq    #0,d0    
  430.     move    (a2)+,d0
  431.     lea    (a4,d0.l),a1
  432.     move.l    a1,P60_ChaPos+P60_temp0-P60_cn(a3)
  433.     move    (a2)+,d0
  434.     lea    (a4,d0.l),a1
  435.     move.l    a1,P60_ChaPos+P60_temp1-P60_cn(a3)
  436.     move    (a2)+,d0
  437.     lea    (a4,d0.l),a1
  438.     move.l    a1,P60_ChaPos+P60_temp2-P60_cn(a3)
  439.     move    (a2)+,d0
  440.     lea    (a4,d0.l),a1
  441.     move.l    a1,P60_ChaPos+P60_temp3-P60_cn(a3)
  442.  
  443.     lea    P60_setrepeat(pc),a0
  444.     move.l    a0,P60_intaddr-P60_cn(a3)
  445.  
  446.     move    #63,P60_rowpos-P60_cn(a3)
  447.     move    #6,P60_speed-P60_cn(a3)
  448.     move    #5,P60_speed2-P60_cn(a3)
  449.     clr    P60_speedis1-P60_cn(a3)
  450.  
  451.     ifne    P60_pl
  452.     clr.l    P60_plcount-P60_cn(a3)
  453.     endc
  454.  
  455.     ifne    P60_pde
  456.     clr    P60_pdelay-P60_cn(a3)
  457.     endc
  458.     clr    (a3)
  459.  
  460.     moveq    #2,d0
  461.     and.b    $bfe001,d0
  462.     move.b    d0,P60_ofilter-P60_cn(a3)
  463.     bset    #1,$bfe001
  464.  
  465.     ifeq    system
  466.     ifne    exec
  467.     move.l    4.w,a6
  468.     moveq    #0,d0
  469.     btst    d0,297(a6)
  470.     beq.b    .no68010
  471.  
  472.     lea    P60_liko(pc),a5
  473.     jsr    -$1e(a6)
  474.  
  475. .no68010
  476.     move.l    d0,a0
  477.     lea    $78(a0),a0
  478.     else
  479.     lea    $78.w,a0
  480.     endc
  481.  
  482.     move.l    a0,P60_vektori-P60_cn(a3)
  483.     move.l    (a0),P60_oldlev6-P60_cn(a3)
  484.     lea    P60_dmason(pc),a1
  485.     move.l    a1,(a0)
  486.     endc
  487.  
  488.     moveq    #0,d0
  489.     lea    $dff000,a6
  490.     move    d0,$a8(a6)
  491.     move    d0,$b8(a6)
  492.     move    d0,$c8(a6)
  493.     move    d0,$d8(a6)
  494.     move    #$f,$96(a6)
  495.  
  496.     ifeq    system
  497.     move    #$2000,$9a(a6)
  498.     lea    $bfd000,a0
  499.     move.b    #$7f,$d00(a0)
  500.     move.b    #8,$e00(a0)
  501.     endc
  502.  
  503.     ifeq    CIA
  504.     move.b    #$4a,$400(a0)
  505.     move.b    #1,$500(a0)
  506.     move.b    #$81,$d00(a0)
  507.     endc
  508.  
  509.     ifne    CIA
  510.     move    (sp)+,d0
  511.     subq    #1,d0
  512.     beq.b    P60_ForcePAL
  513.     subq    #1,d0
  514.     beq.b    P60_NTSC
  515.     ifne    exec
  516.     move.l    4.w,a1
  517.     cmp.b    #60,$212(a1)    ;VBlankFrequency
  518.     beq.b    P60_NTSC
  519.     endc
  520. P60_ForcePAL
  521.     move.l    #1773447,d0    ;PAL
  522.     bra.b    P60_setcia
  523. P60_NTSC
  524.     move.l    #1789773,d0    ;NTSC
  525. P60_setcia
  526.     move.l    d0,P60_timer-P60_cn(a3)
  527.     divu    #125,d0
  528.     move    d0,P60_thi2-P60_cn(a3)
  529.     sub    #$1c8*2,d0
  530.     move    d0,P60_thi-P60_cn(a3)
  531.  
  532.     ifeq    system
  533.     move.b    d0,$400(a0)
  534.     lsr    #8,d0
  535.     move.b    d0,$500(a0)
  536.  
  537.     lea    P60_intti(pc),a1
  538.     move.l    a1,P60_tintti-P60_cn(a3)
  539.     move.l    P60_vektori(pc),a2
  540.     move.l    a1,(a2)
  541.  
  542.     move.b    #$81,$d00(a0)
  543.     move.b    #$19,$e00(a0)
  544.     moveq    #0,d0
  545.     endc
  546.     endc
  547.  
  548.  
  549.     ifeq    system
  550.     move    #$e000,$9a(a6)
  551.     rts
  552.  
  553.     ifne    exec
  554. P60_liko
  555.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  556.     rte
  557.     endc
  558.     endc
  559.  
  560.     ifne    system
  561.     move.l    a6,-(sp)
  562.     clr    P60_server-P60_cn(a3)
  563.  
  564.     move.l    4.w,a6
  565.     moveq    #-1,d0
  566.     jsr    -$14a(a6)
  567.     move.b    d0,P60_sigbit-P60_cn(a3)
  568.     bmi    P60_err
  569.  
  570.     lea    P60_allocport(pc),a1
  571.     move.l    a1,P60_portti-P60_cn(a3)
  572.     move.b    d0,15(a1)
  573.     move.l    a1,-(sp)
  574.     suba.l    a1,a1
  575.     jsr    -$126(a6)
  576.     move.l    (sp)+,a1
  577.     move.l    d0,16(a1)
  578.     lea    P60_reqlist(pc),a0
  579.     move.l    a0,(a0)
  580.     addq.l    #4,(a0)
  581.     clr.l    4(a0)
  582.     move.l    a0,8(a0)
  583.  
  584.     lea    P60_dat(pc),a1
  585.     move.l    a1,P60_reqdata-P60_cn(a3)
  586.     lea    P60_allocreq(pc),a1
  587.     lea    P60_audiodev(pc),a0
  588.     moveq    #0,d0
  589.     moveq    #0,d1
  590.     move.l    4.w,a6
  591.     jsr    -$1bc(a6)
  592.     tst.b    d0
  593.     bne    P60_err
  594.     st.b    P60_audioopen-P60_cn(a3)
  595.  
  596.     lea    P60_timerint(pc),a1
  597.     move.l    a1,P60_timerdata-P60_cn(a3)
  598.     lea    P60_lev6server(pc),a1
  599.     move.l    a1,P60_timerdata+8-P60_cn(a3)
  600.  
  601.     moveq    #0,d3
  602.     lea    P60_cianame(pc),a1
  603.     move.b    #'b',3(a1)
  604. P60_openciares
  605.     moveq    #0,d0
  606.     jsr    -$1f2(a6)
  607.     move.l    d0,P60_ciares-P60_cn(a3)
  608.     beq.b    P60_tryCIAA
  609.     move.l    d0,a6
  610.     lea    P60_timerinterrupt(pc),a1
  611.     moveq    #0,d0
  612.     jsr    -6(a6)
  613.     tst.l    d0
  614.     beq.b    P60_gottimer
  615.     addq.l    #4,d3
  616.     lea    P60_timerinterrupt(pc),a1
  617.     moveq    #1,d0
  618.     jsr    -6(a6)
  619.     tst.l    d0
  620.     beq.b    P60_gottimer
  621. P60_tryCIAA
  622.     lea    P60_cianame(pc),a1
  623.     cmp.b    #'b',3(a1)
  624.     bne.b    P60_err
  625.     subq.b    #1,3(a1)
  626.     moveq    #8,d3
  627.     bra.b    P60_openciares
  628.  
  629. P60_gottimer
  630.     lea    P60_craddr+8(pc),a6
  631.     move.l    P60_ciaaddr(pc,d3),d0
  632.     move.l    d0,(a6)
  633.     sub    #$100,d0
  634.     move.l    d0,-(a6)
  635.     moveq    #2,d3
  636.     btst    #9,d0
  637.     bne.b    P60_timerB
  638.     subq.b    #1,d3
  639.     add    #$100,d0
  640. P60_timerB
  641.     add    #$900,d0
  642.     move.l    d0,-(a6)
  643.     move.l    d0,a0
  644.     and.b    #%10000000,(a0)
  645.     move.b    d3,P60_timeropen-P60_cn(a3)
  646.     moveq    #0,d0
  647.  
  648.     move.l    P60_craddr+4(pc),a1
  649.     move.b    P60_tlo(pc),(a1)
  650.     move.b    P60_thi(pc),$100(a1)
  651.     or.b    #$19,(a0)
  652. P60_pois
  653.     move.l    (sp)+,a6
  654.     rts
  655.  
  656. P60_err    moveq    #-1,d0
  657.     bra.b    P60_pois
  658.     rts
  659.  
  660. P60_ciaaddr
  661.     dc.l    $bfd500,$bfd700,$bfe501,$bfe701
  662.     endc
  663.  
  664. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  665. ;­         Call P60_End to stop the music        ­
  666. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  667. ;­        Uses D0/D1/A0/A1/A3        ­
  668. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  669.     
  670. P60_End    moveq    #0,d0
  671.     move    d0,$a8(a6)
  672.     move    d0,$b8(a6)
  673.     move    d0,$c8(a6)
  674.     move    d0,$d8(a6)
  675.     move    #$f,$96(a6)
  676.  
  677.     and.b    #~2,$bfe001
  678.     move.b    P60_ofilter(pc),d0
  679.     or.b    d0,$bfe001
  680.  
  681.     ifeq    system
  682.     move    #$2000,$9a(a6)
  683.     move.l    P60_vektori(pc),a0
  684.     move.l    P60_oldlev6(pc),(a0)
  685.  
  686.     else
  687.     move.l    a6,-(sp)
  688.     lea    P60_cn(pc),a3
  689.     moveq    #0,d0
  690.     move.b    P60_timeropen(pc),d0
  691.     beq.b    P60_rem1
  692.     move.l    P60_ciares(pc),a6
  693.     lea    P60_timerinterrupt(pc),a1
  694.     subq.b    #1,d0
  695.     jsr    -12(a6)
  696. P60_rem1
  697.     move.l    4.w,a6
  698.     tst.b    P60_audioopen-P60_cn(a3)
  699.     beq.b    P60_rem2
  700.     lea    P60_allocreq(pc),a1
  701.     jsr    -$1c2(a6)
  702.     clr.b    P60_audioopen-P60_cn(a3)
  703. P60_rem2
  704.     moveq    #0,d0
  705.     move.b    P60_sigbit(pc),d0
  706.     bmi.b    P60_rem3
  707.     jsr    -$150(a6)
  708.     st    P60_sigbit-P60_cn(a3)
  709. P60_rem3
  710.     move.l    (sp)+,a6
  711.     endc
  712.     rts
  713.  
  714.     ifne    fade
  715. P60_mfade
  716.     move    P60_master(pc),d0
  717.     move    P60_temp0+P60_Shadow(pc),d1
  718.     mulu    d0,d1
  719.     lsr    #6,d1
  720.     move    d1,$a8(a6)
  721.  
  722.     ifgt    channels-1
  723.     move    P60_temp1+P60_Shadow(pc),d1
  724.     mulu    d0,d1
  725.     lsr    #6,d1
  726.     move    d1,$b8(a6)
  727.     endc
  728.  
  729.     ifgt    channels-2
  730.     move    P60_temp2+P60_Shadow(pc),d1
  731.     mulu    d0,d1
  732.     lsr    #6,d1
  733.     move    d1,$c8(a6)
  734.     endc
  735.  
  736.     ifgt    channels-3
  737.     move    P60_temp3+P60_Shadow(pc),d1
  738.     mulu    d0,d1
  739.     lsr    #6,d1
  740.     move    d1,$d8(a6)
  741.     endc
  742.     rts
  743.     endc
  744.     
  745. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  746. ;­ Call P60_Music every frame to play the music    ­
  747. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  748. ;­              Uses A0-A5/D0-D7        ­
  749. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  750.  
  751. P60_Music
  752.     lea    P60_cn(pc),a3
  753.  
  754.     tst    P60_play-P60_cn(a3)
  755.     bne.b    P60_ohitaaa
  756.     ifne    CIA
  757.     ifeq    system
  758.     move.l    P60_vektori(pc),a5
  759.     move.l    P60_tintti(pc),(a5)
  760.     move.b    P60_tlo2(pc),$bfd400
  761.     move.b    P60_thi2(pc),$bfd500
  762.  
  763.     else
  764.     move.l    P60_craddr+4(pc),a0
  765.     move.b    P60_tlo2(pc),(a0)
  766.     move.b    P60_thi2(pc),$100(a0)
  767.     endc
  768.     endc
  769.     rts
  770.  
  771. P60_ohitaaa
  772.     ifne    fade
  773.     pea    P60_mfade(pc)
  774.     endc
  775.  
  776.     moveq    #Channel_Block_SIZE,d6
  777.     moveq    #16,d7
  778.  
  779.     move    (a3),d4
  780.     addq    #1,d4
  781.     cmp    P60_speed(pc),d4
  782.     beq    P60_playtime
  783.  
  784.     move    d4,(a3)
  785.  
  786. P60_delay
  787.     ifne    CIA
  788.     ifeq    system
  789.     move.l    P60_vektori(pc),a5
  790.     move.l    P60_tintti(pc),(a5)
  791.     move.b    P60_tlo2(pc),$bfd400
  792.     move.b    P60_thi2(pc),$bfd500
  793.  
  794.     else
  795.     move.l    P60_craddr+4(pc),a0
  796.     move.b    P60_tlo2(pc),(a0)
  797.     move.b    P60_thi2(pc),$100(a0)
  798.     endc
  799.     endc
  800.  
  801.     lea    P60_temp0(pc),a5
  802.     lea    $a0(a6),a4
  803.  
  804.     moveq    #channels-1,d5
  805. P60_lopas
  806.     tst    P60_OnOff(a5)
  807.     beq    P60_contfxdone
  808.     moveq    #$f,d0
  809.     and    (a5),d0
  810.     ifeq    opt020
  811.     add    d0,d0
  812.     move    P60_jtab2(pc,d0),d0
  813.     else
  814.     move    P60_jtab2(pc,d0*2),d0
  815.     endc
  816.     jmp    P60_jtab2(pc,d0)
  817.  
  818. P60_jtab2
  819.     dc    P60_contfxdone-P60_jtab2
  820.  
  821.     ifne    P60_pu
  822.     dc    P60_portup-P60_jtab2
  823.     else
  824.     dc    P60_contfxdone-P60_jtab2
  825.     endc
  826.  
  827.     ifne    P60_pd
  828.     dc    P60_portdwn-P60_jtab2
  829.     else
  830.     dc    P60_contfxdone-P60_jtab2
  831.     endc
  832.  
  833.     ifne    P60_tp
  834.     dc    P60_toneport-P60_jtab2
  835.     else
  836.     dc    P60_contfxdone-P60_jtab2
  837.     endc
  838.  
  839.     ifne    P60_vib
  840.     dc    P60_vib2-P60_jtab2
  841.     else
  842.     dc    P60_contfxdone-P60_jtab2
  843.     endc
  844.  
  845.     ifne    P60_tpvs
  846.     dc    P60_tpochvslide-P60_jtab2
  847.     else
  848.     dc    P60_contfxdone-P60_jtab2
  849.     endc
  850.  
  851.     ifne    P60_vbvs
  852.     dc    P60_vibochvslide-P60_jtab2
  853.     else
  854.     dc    P60_contfxdone-P60_jtab2
  855.     endc
  856.  
  857.     ifne    P60_tre
  858.     dc    P60_tremo-P60_jtab2
  859.     else
  860.     dc    P60_contfxdone-P60_jtab2
  861.     endc
  862.  
  863.     ifne    P60_arp
  864.     dc    P60_arpeggio-P60_jtab2
  865.     else
  866.     dc    P60_contfxdone-P60_jtab2
  867.     endc
  868.  
  869.     dc    P60_contfxdone-P60_jtab2
  870.  
  871.     ifne    P60_vs
  872.     dc    P60_volslide-P60_jtab2
  873.     else
  874.     dc    P60_contfxdone-P60_jtab2
  875.     endc
  876.  
  877.     dc    P60_contfxdone-P60_jtab2
  878.     dc    P60_contfxdone-P60_jtab2
  879.     dc    P60_contfxdone-P60_jtab2
  880.  
  881.     ifne    P60_ec
  882.     dc    P60_contecommands-P60_jtab2
  883.     else
  884.     dc    P60_contfxdone-P60_jtab2
  885.     endc
  886.     dc    P60_contfxdone-P60_jtab2
  887.  
  888.     ifne    P60_ec
  889. P60_contecommands
  890.     move.b    P60_Info(a5),d0
  891.     and    #$f0,d0
  892.     lsr    #3,d0
  893.     move    P60_etab2(pc,d0),d0
  894.     jmp    P60_etab2(pc,d0)
  895.  
  896. P60_etab2
  897.     dc    P60_contfxdone-P60_etab2
  898.  
  899.     ifne    P60_fsu
  900.     dc    P60_fineup2-P60_etab2
  901.     else
  902.     dc    P60_contfxdone-P60_etab2
  903.     endc
  904.  
  905.     ifne    P60_fsd
  906.     dc    P60_finedwn2-P60_etab2
  907.     else
  908.     dc    P60_contfxdone-P60_etab2
  909.     endc
  910.  
  911.     dc    P60_contfxdone-P60_etab2
  912.     dc    P60_contfxdone-P60_etab2
  913.  
  914.     dc    P60_contfxdone-P60_etab2
  915.     dc    P60_contfxdone-P60_etab2
  916.  
  917.     dc    P60_contfxdone-P60_etab2
  918.     dc    P60_contfxdone-P60_etab2
  919.  
  920.     ifne    P60_rt
  921.     dc    P60_retrig-P60_etab2
  922.     else
  923.     dc    P60_contfxdone-P60_etab2
  924.     endc
  925.  
  926.     ifne    P60_fvu
  927.     dc    P60_finevup2-P60_etab2
  928.     else
  929.     dc    P60_contfxdone-P60_etab2
  930.     endc
  931.  
  932.     ifne    P60_fvd
  933.     dc    P60_finevdwn2-P60_etab2
  934.     else
  935.     dc    P60_contfxdone-P60_etab2
  936.     endc
  937.  
  938.     ifne    P60_nc
  939.     dc    P60_notecut-P60_etab2
  940.     else
  941.     dc    P60_contfxdone-P60_etab2
  942.     endc
  943.  
  944.     ifne    P60_nd
  945.     dc    P60_notedelay-P60_etab2
  946.     else
  947.     dc    P60_contfxdone-P60_etab2
  948.     endc
  949.  
  950.     dc    P60_contfxdone-P60_etab2
  951.     dc    P60_contfxdone-P60_etab2
  952.     endc
  953.  
  954.     ifne    P60_fsu
  955. P60_fineup2
  956.     tst    (a3)
  957.     bne    P60_contfxdone
  958.     moveq    #$f,d0
  959.     and.b    P60_Info(a5),d0
  960.     sub    d0,P60_Period(a5)
  961.     moveq    #113,d0
  962.     cmp    P60_Period(a5),d0
  963.     ble.b    .jup
  964.     move    d0,P60_Period(a5)
  965. .jup    move    P60_Period(a5),6(a4)
  966.     bra    P60_contfxdone
  967.     endc
  968.  
  969.     ifne    P60_fsd
  970. P60_finedwn2
  971.     tst    (a3)
  972.     bne    P60_contfxdone
  973.     moveq    #$f,d0
  974.     and.b    P60_Info(a5),d0
  975.     add    d0,P60_Period(a5)
  976.     cmp    #856,P60_Period(a5)
  977.     ble.b    .jup
  978.     move    #856,P60_Period(a5)
  979. .jup    move    P60_Period(a5),6(a4)
  980.     bra    P60_contfxdone
  981.     endc
  982.  
  983.     ifne    P60_fvu
  984. P60_finevup2
  985.     tst    (a3)
  986.     bne    P60_contfxdone
  987.     moveq    #$f,d0
  988.     and.b    P60_Info(a5),d0
  989.     add    d0,P60_Volume(a5)
  990.     moveq    #64,d0
  991.     cmp    P60_Volume(a5),d0
  992.     bge.b    .jup
  993.     move    d0,P60_Volume(a5)
  994. .jup    move    P60_Volume(a5),8(a4)
  995.     bra    P60_contfxdone
  996.     endc
  997.  
  998.     ifne    P60_fvd
  999. P60_finevdwn2
  1000.     tst    (a3)
  1001.     bne    P60_contfxdone
  1002.     moveq    #$f,d0
  1003.     and.b    P60_Info(a5),d0
  1004.     sub    d0,P60_Volume(a5)
  1005.     bpl.b    .jup
  1006.     clr    P60_Volume(a5)
  1007. .jup    move    P60_Volume(a5),8(a4)
  1008.     bra    P60_contfxdone
  1009.     endc
  1010.  
  1011.     ifne    P60_nc
  1012. P60_notecut
  1013.     moveq    #$f,d0
  1014.     and.b    P60_Info(a5),d0
  1015.     cmp    (a3),d0
  1016.     bne    P60_contfxdone
  1017.     ifeq    fade
  1018.     clr    8(a4)
  1019.     else
  1020.     clr    P60_Shadow(a5)
  1021.     endc
  1022.     clr    P60_Volume(a5)
  1023.     bra    P60_contfxdone
  1024.     endc
  1025.  
  1026.     ifne    P60_nd
  1027. P60_notedelay
  1028.     moveq    #$f,d0
  1029.     and.b    P60_Info(a5),d0
  1030.     cmp    (a3),d0
  1031.     bne    P60_contfxdone
  1032.  
  1033.     moveq    #$7e,d0
  1034.     and.b    (a5),d0
  1035.     beq    P60_contfxdone
  1036.     move    P60_DMABit(a5),d0
  1037.     move    d0,$96(a6)
  1038.     or    d0,P60_dma-P60_cn(a3)
  1039.     move.l    P60_Sample(a5),a1
  1040.     move.l    (a1)+,(a4)+
  1041.     move    (a1),(a4)+
  1042.     move    P60_Period(a5),(a4)
  1043.     subq.l    #6,a4
  1044.     ifeq    system
  1045.     lea    P60_dmason(pc),a1
  1046.     move.l    P60_vektori(pc),a0
  1047.     move.l    a1,(a0)
  1048.     endc
  1049.  
  1050.     ifeq    CIA
  1051.     move.b    #$19,$bfde00
  1052.     else
  1053.     ifeq    system
  1054.     move.b    #$4a,$bfd400
  1055.     move.b    #1,$bfd500
  1056.     else
  1057.     move    #1,P60_server-P60_cn(a3)
  1058.     move.l    P60_craddr+4(pc),a1
  1059.     move.b    #$4a,(a1)
  1060.     move.b    #1,$100(a1)
  1061.     endc
  1062.     endc
  1063.  
  1064.     bra    P60_contfxdone
  1065.     endc
  1066.  
  1067.     ifne    P60_rt
  1068. P60_retrig
  1069.     subq    #1,P60_RetrigCount(a5)
  1070.     bne    P60_contfxdone
  1071.     move    P60_DMABit(a5),d0
  1072.     move    d0,$96(a6)
  1073.     or    d0,P60_dma-P60_cn(a3)
  1074.     move.l    P60_Sample(a5),a1
  1075.     move.l    (a1)+,(a4)
  1076.     move    (a1),4(a4)
  1077.  
  1078.     ifeq    system
  1079.     lea    P60_dmason(pc),a1
  1080.     move.l    P60_vektori(pc),a0
  1081.     move.l    a1,(a0)
  1082.     endc
  1083.  
  1084.     ifeq    CIA
  1085.     move.b    #$19,$bfde00
  1086.     else
  1087.     ifeq    system
  1088.     move.b    #$4a,$bfd400
  1089.     move.b    #1,$bfd500
  1090.     else
  1091.     move    #1,P60_server-P60_cn(a3)
  1092.     move.l    P60_craddr+4(pc),a1
  1093.     move.b    #$4a,(a1)
  1094.     move.b    #1,$100(a1)
  1095.     endc
  1096.     endc
  1097.  
  1098.     moveq    #$f,d0
  1099.     and.b    P60_Info(a5),d0
  1100.     move    d0,P60_RetrigCount(a5)
  1101.     bra    P60_contfxdone
  1102.     endc
  1103.  
  1104.     ifne    P60_arp
  1105. P60_arplist
  1106.     dc.b 0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1
  1107.  
  1108. P60_arpeggio
  1109.     move    (a3),d0
  1110.     move.b    P60_arplist(pc,d0),d0
  1111.     beq.b    .arp0
  1112.     subq.b    #1,d0
  1113.     beq.b    P60_arp1
  1114.     moveq    #$f,d0
  1115.     and.b    P60_Info(a5),d0
  1116.     bra.b    P60_arp3
  1117.  
  1118. .arp0    move    P60_Note(a5),d0
  1119.     move    P60_periods(pc,d0),6(a4)
  1120.     bra    P60_contfxdone
  1121. P60_arp1
  1122.     move.b    P60_Info(a5),d0
  1123.     lsr    #4,d0
  1124. P60_arp3
  1125.     add    d0,d0
  1126.     add    P60_Note(a5),d0
  1127.     move    P60_periods(pc,d0),6(a4)
  1128.     bra    P60_contfxdone
  1129.     endc
  1130.  
  1131. P60_periods
  1132.     ifne    P60_ft
  1133.     incbin    periods
  1134.     else
  1135.     incbin    periods.nft
  1136.     endc
  1137.  
  1138.     ifne    P60_vs
  1139. P60_volslide
  1140.     move.b    P60_Info(a5),d0
  1141.     sub.b    d0,P60_Volume+1(a5)
  1142.     bpl.b    .test
  1143.     clr    P60_Volume(a5)
  1144.     ifeq    fade
  1145.     clr    8(a4)
  1146.     else
  1147.     clr    P60_Shadow(a5)
  1148.     endc
  1149.     bra    P60_contfxdone
  1150. .test    moveq    #64,d0
  1151.     cmp    P60_Volume(a5),d0
  1152.     bge.b    .ncs
  1153.     move    d0,P60_Volume(a5)
  1154.     ifeq    fade
  1155.     move    d0,8(a4)
  1156.     else
  1157.     move    d0,P60_Shadow(a5)
  1158.     endc
  1159.     bra.b    P60_contfxdone
  1160. .ncs    
  1161.     ifeq    fade
  1162.     move    P60_Volume(a5),8(a4)
  1163.     else
  1164.     move    P60_Volume(a5),P60_Shadow(a5)
  1165.     endc
  1166.     bra.b    P60_contfxdone
  1167.     endc
  1168.  
  1169.     ifne    P60_tpvs
  1170. P60_tpochvslide
  1171.     move.b    P60_Info(a5),d0
  1172.     sub.b    d0,P60_Volume+1(a5)
  1173.     bpl.b    .test
  1174.     clr    P60_Volume(a5)
  1175.     ifeq    fade
  1176.     clr    8(a4)
  1177.     else
  1178.     clr    P60_Shadow(a5)
  1179.     endc
  1180.     bra.b    P60_toneport
  1181. .test    moveq    #64,d0
  1182.     cmp    P60_Volume(a5),d0
  1183.     bge.b    .ncs
  1184.     move    d0,P60_Volume(a5)
  1185. .ncs
  1186.     ifeq    fade
  1187.     move    P60_Volume(a5),8(a4)
  1188.     else
  1189.     move    P60_Volume(a5),P60_Shadow(a5)
  1190.     endc
  1191.     endc
  1192.  
  1193.     ifne    P60_tp
  1194. P60_toneport
  1195.     move    P60_ToPeriod(a5),d0
  1196.     beq.b    P60_contfxdone
  1197.     move    P60_TPSpeed(a5),d1
  1198.     cmp    P60_Period(a5),d0
  1199.     blt.b    .topoup
  1200.  
  1201.     add    d1,P60_Period(a5)
  1202.     cmp    P60_Period(a5),d0
  1203.     bgt.b    P60_toposetper
  1204.     move    d0,P60_Period(a5)
  1205.     clr    P60_ToPeriod(a5)
  1206.     move    d0,6(a4)
  1207.     bra.b    P60_contfxdone
  1208.  
  1209. .topoup
  1210.     sub    d1,P60_Period(a5)
  1211.     cmp    P60_Period(a5),d0
  1212.     blt.b    P60_toposetper
  1213.     move    d0,P60_Period(a5)
  1214.     clr    P60_ToPeriod(a5)
  1215. P60_toposetper
  1216.     move    P60_Period(a5),6(a4)
  1217.     else
  1218.     nop
  1219.     endc
  1220.  
  1221. P60_contfxdone
  1222.     ifne    P60_il
  1223.     bsr    P60_funk2
  1224.     endc
  1225.  
  1226.     add.l    d6,a5
  1227.     add.l    d7,a4
  1228.     dbf    d5,P60_lopas
  1229.  
  1230.     cmp    P60_speed2(pc),d4
  1231.     beq.b    P60_preplay
  1232.     rts
  1233.  
  1234.     ifne    P60_pu
  1235. P60_portup
  1236.     moveq    #0,D0
  1237.     move.b    P60_Info(a5),d0
  1238.     sub    d0,P60_Period(a5)
  1239.     moveq    #113,d0
  1240.     cmp    P60_Period(a5),d0
  1241.     ble.b    .skip
  1242.     move    d0,P60_Period(a5)
  1243.     move    d0,6(a4)
  1244.     bra.b    P60_contfxdone
  1245. .skip
  1246.     move    P60_Period(a5),6(a4)
  1247.     bra.b    P60_contfxdone
  1248.     endc
  1249.  
  1250.     ifne    P60_pd
  1251. P60_portdwn
  1252.     moveq    #0,d0
  1253.     move.b    P60_Info(a5),d0
  1254.     add    d0,P60_Period(a5)
  1255.     cmp    #856,P60_Period(a5)
  1256.     ble.b    .skip
  1257.     move    #856,d0
  1258.     move    d0,P60_Period(a5)
  1259.     move    d0,6(a4)
  1260.     bra.b    P60_contfxdone
  1261. .skip
  1262.     move    P60_Period(a5),6(a4)
  1263.     bra.b    P60_contfxdone
  1264.     endc
  1265.  
  1266. P60_preplay
  1267.     ifne    P60_pde
  1268.     tst    P60_pdelay-P60_cn(a3)
  1269.     beq.b    .djdj
  1270.     rts
  1271. .djdj
  1272.     endc
  1273.  
  1274.     lea    P60_temp0(pc),a5
  1275.     lea    P60_Samples-16(pc),a0
  1276.  
  1277.     moveq    #channels-1,d5
  1278. P60_loaps
  1279.     ifne    P60_pl
  1280.     lea    P60_TData(a5),a1
  1281.     move    2(a5),(a1)+
  1282.     move.l    P60_ChaPos(a5),(a1)+
  1283.     move.l    P60_TempPos(a5),(a1)+
  1284.     move    P60_TempLen(a5),(a1)
  1285.     endc
  1286.  
  1287.     tst.b    P60_Pack(a5)
  1288.     beq.b    P60_takeone
  1289.     bmi.b    .keepsame
  1290.  
  1291.     subq.b    #1,P60_Pack(a5)
  1292.     clr    P60_OnOff(a5)
  1293.     add.l    d6,a5
  1294.     dbf    d5,P60_loaps
  1295.     rts
  1296.  
  1297. .keepsame
  1298.     addq.b    #1,P60_Pack(a5)
  1299.     bra.b    P60_dko
  1300.  
  1301. P60_takeone
  1302.     tst.b    P60_TempLen+1(a5)
  1303.     beq.b    P60_takenorm
  1304.  
  1305.     subq.b    #1,P60_TempLen+1(a5)
  1306.     move.l    P60_TempPos(a5),a2
  1307.  
  1308. P60_jedi
  1309.     move.b    (a2)+,(a5)
  1310.     bpl.b    P60_normal
  1311.     not.b    (a5)+
  1312.     move.b    (a2)+,(a5)+
  1313.     ifeq    opt020
  1314.     move.b    (a2)+,(a5)+
  1315.     move.b    (a2)+,(a5)+
  1316.     else
  1317.     move    (a2)+,(a5)+
  1318.     endc
  1319.  
  1320.     subq.l    #4,a5
  1321.     move.l    a2,P60_TempPos(a5)
  1322.     bra.b    P60_dko
  1323.     
  1324. P60_normal
  1325.     ifeq    opt020
  1326.     move.b    (a2)+,1(a5)
  1327.     move.b    (a2)+,2(a5)
  1328.     else
  1329.     move    (a2)+,1(a5)
  1330.     endc
  1331.  
  1332.     move.l    a2,P60_TempPos(a5)
  1333.     bra.b    P60_dko
  1334.  
  1335. P60_takenorm
  1336.     move.l    P60_ChaPos(a5),a2
  1337.     move.b    (a2)+,(a5)
  1338.     bmi.b    P60_packed
  1339.     ifeq    opt020
  1340.     move.b    (a2)+,1(a5)
  1341.     move.b    (a2)+,2(a5)
  1342.     else
  1343.     move    (a2)+,1(a5)
  1344.     endc
  1345.     move.l    a2,P60_ChaPos(a5)
  1346.     bra.b    P60_dko
  1347.  
  1348. P60_kuiskus
  1349.     move.b    (a2)+,P60_TempLen+1(a5)
  1350.     moveq    #0,d0
  1351.     ifeq    opt020
  1352.     move.b    (a2)+,d0
  1353.     lsl    #8,d0
  1354.     move.b    (a2)+,d0
  1355.     else
  1356.     move    (a2)+,d0
  1357.     endc
  1358.  
  1359.     move.l    a2,P60_ChaPos(a5)
  1360.     sub.l    d0,a2
  1361.     bra.b    P60_jedi
  1362.  
  1363. P60_packed
  1364.     cmp.b    #$80,(a5)
  1365.     beq.b    P60_kuiskus
  1366.     not.b    (a5)+
  1367.     move.b    (a2)+,(a5)+
  1368.     ifeq    opt020
  1369.     move.b    (a2)+,(a5)+
  1370.     move.b    (a2)+,(a5)+
  1371.     else
  1372.     move    (a2)+,(a5)+
  1373.     endc
  1374.     subq.l    #4,a5
  1375.     move.l    a2,P60_ChaPos(a5)
  1376.  
  1377. P60_dko    st    P60_OnOff(a5)
  1378.     move    (a5),d0
  1379.     and    #$1f0,d0
  1380.     beq.b    .koto
  1381.     lea    (a0,d0),a1
  1382.     move.l    a1,P60_Sample(a5)
  1383.     ifne    P60_ft
  1384.     move.l    P60_SampleVolume(a1),P60_Volume(a5)
  1385.     else
  1386.     move    P60_SampleVolume(a1),P60_Volume(a5)
  1387.     endc
  1388.     ifne    P60_il
  1389.     move.l    P60_RepeatOffset(a1),P60_Wave(a5)
  1390.     endc
  1391.     ifne    P60_sof
  1392.     clr    P60_Offset(a5)
  1393.     endc
  1394.  
  1395. .koto    add.l    d6,a5
  1396.     dbf    d5,P60_loaps
  1397.     rts
  1398.  
  1399. P60_playtime
  1400.     clr    (a3)
  1401.     ifne    P60_pde
  1402.     tst    P60_pdelay-P60_cn(a3)
  1403.     beq.b    .djdj
  1404.     subq    #1,P60_pdelay-P60_cn(a3)
  1405.     bra    P60_delay
  1406. .djdj
  1407.     endc
  1408.  
  1409.     tst    P60_speedis1-P60_cn(a3)
  1410.     beq.b    .mo
  1411.     bsr    P60_preplay
  1412.  
  1413. .mo    lea    P60_temp0(pc),a5
  1414.     lea    $a0(a6),a4
  1415.  
  1416.     ifne    system
  1417.     moveq    #1,d4
  1418.     move    d4,P60_server-P60_cn(a3)
  1419.     move.l    P60_craddr+4(pc),a1
  1420.     move.b    #$4a,(a1)
  1421.     move.b    d4,$100(a1)
  1422.     else
  1423.     lea    P60_dmason(pc),a1
  1424.     move.l    P60_vektori(pc),a2
  1425.     move.l    a1,(a2)
  1426.  
  1427.     ifeq    CIA
  1428.     move.b    #$19,$bfde00
  1429.     else
  1430.     move.b    #$4a,$bfd400
  1431.     move.b    #1,$bfd500
  1432.     endc
  1433.     endc
  1434.  
  1435.     lea    P60_periods(pc),a2
  1436.  
  1437.     moveq    #0,d4
  1438.     moveq    #channels-1,d5
  1439. P60_los    tst    P60_OnOff(a5)
  1440.     beq.b    P60_nocha
  1441.  
  1442.     moveq    #$f,d0
  1443.     and    (a5),d0
  1444.     lea    P60_jtab(pc),a1
  1445.     add    d0,d0
  1446.     add.l    d0,a1
  1447.     add    (a1),a1
  1448.     jmp    (a1)
  1449.  
  1450. P60_fxdone
  1451.     moveq    #$7e,d0
  1452.     and.b    (a5),d0
  1453.     beq.b    P60_nocha
  1454.     ifne    P60_vib
  1455.     clr.b    P60_VibPos(a5)
  1456.     endc
  1457.     ifne    P60_tre
  1458.     clr.b    P60_TrePos(a5)
  1459.     endc
  1460.  
  1461.      ifne    P60_ft
  1462.     add    P60_Fine(a5),d0
  1463.     endc
  1464.     move    d0,P60_Note(a5)
  1465.     move    (a2,d0),P60_Period(a5)
  1466.  
  1467. P60_zample
  1468.     ifne    P60_sof
  1469.     tst    P60_Offset(a5)
  1470.     bne    P60_pek
  1471.     endc
  1472.  
  1473.     or    P60_DMABit(a5),d4
  1474.     move    d4,$96(a6)
  1475.     move.l    P60_Sample(a5),a1
  1476.     move.l    (a1)+,(a4)
  1477.     move    (a1),4(a4)
  1478.  
  1479. P60_nocha
  1480.     ifeq    fade
  1481.     move.l    P60_Period(a5),6(a4)
  1482.     else
  1483.     move    P60_Period(a5),6(a4)
  1484.     move    P60_Volume(a5),P60_Shadow(a5)
  1485.     endc
  1486.  
  1487. P60_skip
  1488.     ifne    P60_il
  1489.     bsr    P60_funk2
  1490.     endc
  1491.  
  1492.     add.l    d6,a5
  1493.     add.l    d7,a4
  1494.     dbf    d5,P60_los
  1495.  
  1496.     move.b    d4,P60_dma+1-P60_cn(a3)
  1497.  
  1498.     ifne    P60_pl
  1499.     tst.b    P60_plflag+1-P60_cn(a3)
  1500.     beq.b    P60_ohittaa
  1501.  
  1502.     lea    P60_temp0(pc),a1
  1503.     lea    P60_looppos(pc),a0
  1504.     moveq    #channels-1,d0
  1505. .talt    move.b    1(a0),3(a1)
  1506.     addq.l    #2,a0
  1507.     move.l    (a0)+,P60_ChaPos(a1)
  1508.     move.l    (a0)+,P60_TempPos(a1)
  1509.     move    (a0)+,P60_TempLen(a1)
  1510.     add.l    d6,a1
  1511.     dbf    d0,.talt
  1512.  
  1513.     move    P60_plrowpos(pc),P60_rowpos-P60_cn(a3)
  1514.     clr.b    P60_plflag+1-P60_cn(a3)
  1515.     rts
  1516.     endc
  1517.  
  1518. P60_ohittaa
  1519.     subq    #1,P60_rowpos-P60_cn(a3)
  1520.     bmi.b    P60_nextpattern
  1521.     rts
  1522.  
  1523. P60_nextpattern
  1524.     ifne    P60_pl
  1525.     clr    P60_plflag-P60_cn(a3)
  1526.     endc
  1527.     move.l    P60_patternbase(pc),a4
  1528.     moveq    #63,d0
  1529.     move    d0,P60_rowpos-P60_cn(a3)
  1530.     move.l    P60_spos(pc),a1
  1531.     move.b    (a1)+,d0
  1532.     bpl.b    P60_dk
  1533.     move.l    P60_possibase(pc),a1
  1534.     move.b    (a1)+,d0
  1535. P60_dk    move.l    a1,P60_spos-P60_cn(a3)
  1536.     lsl    #3,d0
  1537.     move.l    P60_positionbase(pc),a1
  1538.     add.l    d0,a1
  1539.  
  1540.     move    (a1)+,d0
  1541.     lea    (a4,d0.l),a2
  1542.     move.l    a2,P60_ChaPos+P60_temp0-P60_cn(a3)
  1543.     move    (a1)+,d0
  1544.     lea    (a4,d0.l),a2
  1545.     move.l    a2,P60_ChaPos+P60_temp1-P60_cn(a3)
  1546.     move    (a1)+,d0
  1547.     lea    (a4,d0.l),a2
  1548.     move.l    a2,P60_ChaPos+P60_temp2-P60_cn(a3)
  1549.     move    (a1),d0
  1550.     add.l    d0,a4
  1551.     move.l    a4,P60_ChaPos+P60_temp3-P60_cn(a3)
  1552.     rts
  1553.  
  1554.     ifne    P60_tp
  1555. P60_settoneport
  1556.     move.b    P60_Info(a5),d0
  1557.     beq.b    P60_toponochange
  1558.     move.b    d0,P60_TPSpeed+1(a5)
  1559. P60_toponochange
  1560.     moveq    #$7e,d0
  1561.     and.b    (a5),d0
  1562.     beq    P60_nocha
  1563.     add    P60_Fine(a5),d0
  1564.     move    d0,P60_Note(a5)
  1565.     move    (a2,d0),P60_ToPeriod(a5)
  1566.     bra    P60_nocha
  1567.     endc
  1568.  
  1569.     ifne    P60_sof
  1570. P60_sampleoffse
  1571.     moveq    #$7e,d0
  1572.     and.b    (a5),d0
  1573.     beq    P60_nocha
  1574.     ifne    P60_vib
  1575.     clr.b    P60_VibPos(a5)
  1576.     endc
  1577.     ifne    P60_tre
  1578.     clr.b    P60_TrePos(a5)
  1579.     endc
  1580.  
  1581.     ifne    P60_ft
  1582.     add    P60_Fine(a5),d0
  1583.     endc
  1584.     move    d0,P60_Note(a5)
  1585.     move    (a2,d0),P60_Period(a5)
  1586.  
  1587.     moveq    #0,d1
  1588.     move    #$ff00,d1
  1589.     and    2(a5),d1
  1590.     beq.b    P60_pek
  1591.     add    d1,P60_Offset(a5)
  1592. P60_pek    move    P60_Offset(a5),d1
  1593.     move    d1,P60_Offset(a5)
  1594.     or    P60_DMABit(a5),d4
  1595.     move    d4,$96(a6)
  1596.     move.l    P60_Sample(a5),a1
  1597.     move.l    (a1)+,d0
  1598.     add.l    d1,d0
  1599.     move.l    d0,(a4)
  1600.     lsr    #1,d1
  1601.     move    (a1),d0
  1602.     sub    d1,d0
  1603.     bpl.b    P60_offok
  1604.     move.l    -4(a1),(a4)
  1605.     moveq    #1,d0
  1606. P60_offok
  1607.     move    d0,4(a4)
  1608.     bra    P60_nocha
  1609.     endc
  1610.  
  1611.     ifne    P60_vl
  1612. P60_volum
  1613.     move.b    P60_Info(a5),P60_Volume+1(a5)
  1614.     bra    P60_fxdone
  1615.     endc
  1616.  
  1617.     ifne    P60_pj
  1618. P60_posjmp
  1619.     moveq    #0,d0
  1620.     move.b    P60_Info(a5),d0
  1621.     add.l    P60_possibase(pc),d0
  1622.     move.l    d0,P60_spos-P60_cn(a3)
  1623.     endc
  1624.  
  1625.     ifne    P60_pb
  1626. P60_pattbreak
  1627.     moveq    #64,d0
  1628.     move    d0,P60_rowpos-P60_cn(a3)
  1629.     move.l    P60_spos(pc),a1
  1630.     move.l    P60_patternbase(pc),a0
  1631.     move.b    (a1)+,d0
  1632.     bpl.b    P60_dk2
  1633.     move.l    P60_possibase(pc),a1
  1634.     move.b    (a1)+,d0
  1635. P60_dk2    move.l    a1,P60_spos-P60_cn(a3)
  1636.     move.l    P60_positionbase(pc),a1
  1637.     lsl    #3,d0
  1638.     add.l    d0,a1
  1639.     movem    (a1),d0-d3
  1640.     lea    (a0,d0.l),a1
  1641.     move    d1,d0
  1642.     move.l    a1,P60_ChaPos+P60_temp0-P60_cn(a3)
  1643.     lea    (a0,d0.l),a1
  1644.     move.l    a1,P60_ChaPos+P60_temp1-P60_cn(a3)
  1645.     move    d2,d0
  1646.     lea    (a0,d0.l),a1
  1647.     move.l    a1,P60_ChaPos+P60_temp2-P60_cn(a3)
  1648.     move    d3,d0
  1649.     add.l    d0,a0
  1650.     move.l    a0,P60_ChaPos+P60_temp3-P60_cn(a3)
  1651.     bra    P60_fxdone
  1652.     endc
  1653.  
  1654.     ifne    P60_vib
  1655. P60_vibrato
  1656.     move.b    P60_Info(a5),d0
  1657.     beq    P60_fxdone
  1658.     move.b    d0,d1
  1659.     move.b    P60_VibCmd(a5),d2
  1660.     and.b    #$f,d0
  1661.     beq.b    P60_vibskip
  1662.     and.b    #$f0,d2
  1663.     or.b    d0,d2
  1664. P60_vibskip
  1665.     and.b    #$f0,d1
  1666.     beq.b    P60_vibskip2
  1667.     and.b    #$f,d2
  1668.     or.b    d1,d2
  1669. P60_vibskip2
  1670.     move.b    d2,P60_VibCmd(a5)
  1671.     bra    P60_fxdone
  1672.     endc
  1673.  
  1674.     ifne    P60_tre
  1675. P60_settremo
  1676.     move.b    P60_Info(a5),d0
  1677.     beq    P60_fxdone
  1678.     move.b    d0,d1
  1679.     move.b    P60_TreCmd(a5),d2
  1680.     moveq    #$f,d3
  1681.     and.b    d3,d0
  1682.     beq.b    P60_treskip
  1683.     and.b    #$f0,d2
  1684.     or.b    d0,d2
  1685. P60_treskip
  1686.     and.b    #$f0,d1
  1687.     beq.b    P60_treskip2
  1688.     and.b    d3,d2
  1689.     or.b    d1,d2
  1690. P60_treskip2
  1691.     move.b    d2,P60_TreCmd(a5)
  1692.     bra    P60_fxdone
  1693.     endc
  1694.  
  1695.     ifne    P60_ec
  1696. P60_ecommands
  1697.     move.b    P60_Info(a5),d0
  1698.     and.b    #$f0,d0
  1699.     lsr    #3,d0
  1700.     move    P60_etab(pc,d0),d0
  1701.     jmp    P60_etab(pc,d0)
  1702.  
  1703. P60_etab
  1704.     ifne    P60_fi
  1705.     dc    P60_filter-P60_etab
  1706.     else
  1707.     dc    P60_fxdone-P60_etab
  1708.     endc
  1709.  
  1710.     ifne    P60_fsu
  1711.     dc    P60_fineup-P60_etab
  1712.     else
  1713.     dc    P60_fxdone-P60_etab
  1714.     endc
  1715.  
  1716.     ifne    P60_fsd
  1717.     dc    P60_finedwn-P60_etab
  1718.     else
  1719.     dc    P60_fxdone-P60_etab
  1720.     endc
  1721.  
  1722.     dc    P60_fxdone-P60_etab
  1723.     dc    P60_fxdone-P60_etab
  1724.  
  1725.     ifne    P60_sft
  1726.     dc    P60_setfinetune-P60_etab
  1727.     else
  1728.     dc    P60_fxdone-P60_etab
  1729.     endc
  1730.  
  1731.     ifne    P60_pl
  1732.     dc    P60_patternloop-P60_etab
  1733.     else
  1734.     dc    P60_fxdone-P60_etab
  1735.     endc
  1736.  
  1737.     dc    P60_fxdone-P60_etab
  1738.  
  1739.     ifne    P60_timing
  1740.     dc    P60_sete8-P60_etab
  1741.     else
  1742.     dc    P60_fxdone-P60_etab
  1743.     endc
  1744.  
  1745.     ifne    P60_rt
  1746.     dc    P60_setretrig-P60_etab
  1747.     else
  1748.     dc    P60_fxdone-P60_etab
  1749.     endc
  1750.  
  1751.     ifne    P60_fvu
  1752.     dc    P60_finevup-P60_etab
  1753.     else
  1754.     dc    P60_fxdone-P60_etab
  1755.     endc
  1756.  
  1757.     ifne    P60_fvd
  1758.     dc    P60_finevdwn-P60_etab
  1759.     else
  1760.     dc    P60_fxdone-P60_etab
  1761.     endc
  1762.  
  1763.     dc    P60_fxdone-P60_etab
  1764.  
  1765.     ifne    P60_nd
  1766.     dc    P60_ndelay-P60_etab
  1767.     else
  1768.     dc    P60_fxdone-P60_etab
  1769.     endc
  1770.  
  1771.     ifne    P60_pde
  1772.     dc    P60_pattdelay-P60_etab
  1773.     else
  1774.     dc    P60_fxdone-P60_etab
  1775.     endc
  1776.  
  1777.     ifne    P60_il
  1778.     dc    P60_funk-P60_etab
  1779.     else
  1780.     dc    P60_fxdone-P60_etab
  1781.     endc
  1782.     endc
  1783.  
  1784.     ifne    P60_fi
  1785. P60_filter
  1786.     move.b    P60_Info(a5),d0
  1787.     and.b    #$fd,$bfe001
  1788.     or.b    d0,$bfe001
  1789.     bra    P60_fxdone
  1790.     endc
  1791.  
  1792.     ifne    P60_fsu
  1793. P60_fineup
  1794.     P60_getnote
  1795.  
  1796.     moveq    #$f,d0
  1797.     and.b    P60_Info(a5),d0
  1798.     sub    d0,P60_Period(a5)
  1799.     moveq    #113,d0
  1800.     cmp    P60_Period(a5),d0
  1801.     ble.b    .jup
  1802.     move    d0,P60_Period(a5)
  1803. .jup    moveq    #$7e,d0
  1804.     and.b    (a5),d0
  1805.     bne    P60_zample
  1806.     bra    P60_nocha
  1807.     endc
  1808.  
  1809.     ifne    P60_fsd
  1810. P60_finedwn
  1811.     P60_getnote
  1812.  
  1813.     moveq    #$f,d0
  1814.     and.b    P60_Info(a5),d0
  1815.     add    d0,P60_Period(a5)
  1816.     cmp    #856,P60_Period(a5)
  1817.     ble.b    .jup
  1818.     move    #856,P60_Period(a5)
  1819. .jup    moveq    #$7e,d0
  1820.     and.b    (a5),d0
  1821.     bne    P60_zample
  1822.     bra    P60_nocha
  1823.     endc
  1824.  
  1825.     ifne    P60_sft
  1826. P60_setfinetune
  1827.     moveq    #$f,d0
  1828.     and.b    P60_Info(a5),d0
  1829.     ifeq    opt020
  1830.     add    d0,d0
  1831.     move    P60_mulutab(pc,d0),P60_Fine(a5)
  1832.     else
  1833.     move    P60_mulutab(pc,d0*2),P60_Fine(a5)
  1834.     endc
  1835.     bra    P60_fxdone
  1836.  
  1837. P60_mulutab
  1838.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  1839.     endc
  1840.  
  1841.     ifne    P60_pl
  1842. P60_patternloop
  1843.     moveq    #$f,d0
  1844.     and.b    P60_Info(a5),d0
  1845.     beq.b    P60_setloop
  1846.  
  1847.     tst.b    P60_plflag-P60_cn(a3)
  1848.     bne.b    P60_noset
  1849.  
  1850.     move    d0,P60_plcount-P60_cn(a3)
  1851.     st.b    P60_plflag-P60_cn(a3)
  1852. P60_noset
  1853.     tst    P60_plcount-P60_cn(a3)
  1854.     bne.b    P60_looppaa
  1855.     clr.b    P60_plflag-P60_cn(a3)
  1856.     bra    P60_fxdone
  1857.     
  1858. P60_looppaa
  1859.     st.b    P60_plflag+1-P60_cn(a3)
  1860.     subq    #1,P60_plcount-P60_cn(a3)
  1861.     bra    P60_fxdone
  1862.  
  1863. P60_setloop
  1864.     tst.b    P60_plflag-P60_cn(a3)
  1865.     bne    P60_fxdone
  1866.     move    P60_rowpos(pc),P60_plrowpos-P60_cn(a3)
  1867.     lea    P60_temp0+P60_TData(pc),a1
  1868.     lea    P60_looppos(pc),a0
  1869.     moveq    #channels-1,d0
  1870. .talt    move.l    (a1)+,(a0)+
  1871.     move.l    (a1)+,(a0)+
  1872.     move.l    (a1),(a0)+
  1873.     subq.l    #8,a1
  1874.     add.l    d6,a1
  1875.     dbf    d0,.talt
  1876.     bra    P60_fxdone
  1877.     endc
  1878.  
  1879.     ifne    P60_fvu
  1880. P60_finevup
  1881.     moveq    #$f,d0
  1882.     and.b    P60_Info(a5),d0
  1883.     add    d0,P60_Volume(a5)
  1884.     moveq    #64,d0
  1885.     cmp    P60_Volume(a5),d0
  1886.     bge    P60_fxdone
  1887.     move    d0,P60_Volume(a5)
  1888.     bra    P60_fxdone
  1889.     endc
  1890.  
  1891.     ifne    P60_fvd
  1892. P60_finevdwn
  1893.     moveq    #$f,d0
  1894.     and.b    P60_Info(a5),d0
  1895.     sub    d0,P60_Volume(a5)
  1896.     bpl    P60_fxdone
  1897.     clr    P60_Volume(a5)
  1898.     bra    P60_fxdone
  1899.     endc
  1900.  
  1901.     ifne    P60_timing
  1902. P60_sete8
  1903.     moveq    #$f,d0
  1904.     and.b    P60_Info(a5),d0
  1905.     move    d0,P60_E8-P60_cn(a3)
  1906.     bra    P60_fxdone
  1907.     endc
  1908.  
  1909.     ifne    P60_rt
  1910. P60_setretrig
  1911.     moveq    #$f,d0
  1912.     and.b    P60_Info(a5),d0
  1913.     move    d0,P60_RetrigCount(a5)
  1914.     bra    P60_fxdone
  1915.     endc
  1916.  
  1917.     ifne    P60_nd
  1918. P60_ndelay
  1919.     moveq    #$7e,d0
  1920.     and.b    (a5),d0
  1921.     beq    P60_skip
  1922.     ifne    P60_vib
  1923.     clr.b    P60_VibPos(a5)
  1924.     endc
  1925.     ifne    P60_tre
  1926.     clr.b    P60_TrePos(a5)
  1927.     endc
  1928.     ifne    P60_ft
  1929.     add    P60_Fine(a5),d0
  1930.     endc
  1931.     move    d0,P60_Note(a5)
  1932.     move    (a2,d0),P60_Period(a5)
  1933.     ifeq    fade
  1934.     move    P60_Volume(a5),8(a4)
  1935.     else
  1936.     move    P60_Volume(a5),P60_Shadow(a5)
  1937.     endc
  1938.     bra    P60_skip
  1939.     endc
  1940.  
  1941.     ifne    P60_pde
  1942. P60_pattdelay
  1943.     moveq    #$f,d0
  1944.     and.b    P60_Info(a5),d0
  1945.     move    d0,P60_pdelay-P60_cn(a3)
  1946.     bra    P60_fxdone
  1947.     endc
  1948.  
  1949.     ifne    P60_sd
  1950. P60_cspeed
  1951.     move.b    P60_Info(a5),d0
  1952.  
  1953.     ifne    CIA
  1954.     tst    P60_Tempo-P60_cn(a3)
  1955.     beq.b    P60_VBlank
  1956.     cmp.b    #32,d0
  1957.     bhs.b    P60_STempo
  1958.     endc
  1959.  
  1960. P60_VBlank
  1961.     cmp.b    #1,d0
  1962.     beq.b    P60_jkd
  1963.  
  1964.     move.b    d0,P60_speed+1-P60_cn(a3)
  1965.     subq.b    #1,d0
  1966.     move.b    d0,P60_speed2+1-P60_cn(a3)
  1967.     clr    P60_speedis1-P60_cn(a3)
  1968.     bra    P60_fxdone
  1969.  
  1970. P60_jkd    move.b    d0,P60_speed+1-P60_cn(a3)
  1971.     move.b    d0,P60_speed2+1-P60_cn(a3)
  1972.     st    P60_speedis1-P60_cn(a3)
  1973.     bra    P60_fxdone
  1974.  
  1975.  
  1976.     ifne    CIA
  1977. P60_STempo
  1978.     move.l    P60_timer(pc),d1
  1979.     divu    d0,d1
  1980.     move    d1,P60_thi2-P60_cn(a3)
  1981.     sub    #$1c8*2,d1
  1982.     move    d1,P60_thi-P60_cn(a3)
  1983.     bra    P60_fxdone
  1984.     endc
  1985.     endc
  1986.  
  1987.     ifne    P60_vbvs
  1988. P60_vibochvslide
  1989.     move.b    P60_Info(a5),d0
  1990.     sub.b    d0,P60_Volume+1(a5)
  1991.     bpl.b    P60_test62
  1992.     clr    P60_Volume(a5)
  1993.     ifeq    fade
  1994.     clr    8(a4)
  1995.     else
  1996.     clr    P60_Shadow(a5)
  1997.     endc
  1998.     bra.b    P60_vib2
  1999. P60_test62
  2000.     moveq    #64,d0
  2001.     cmp    P60_Volume(a5),d0
  2002.     bge.b    .ncs2
  2003.     move    d0,P60_Volume(a5)
  2004. .ncs2
  2005.     ifeq    fade
  2006.     move    P60_Volume(a5),8(a4)
  2007.     else
  2008.     move    P60_Volume(a5),P60_Shadow(a5)
  2009.     endc
  2010.     endc
  2011.  
  2012.     ifne    P60_vib
  2013. P60_vib2
  2014.     move    #$f00,d0
  2015.     move    P60_VibCmd(a5),d1
  2016.     and    d1,d0
  2017.     lsr    #2,d0
  2018.     
  2019.     lsr    #1,d1
  2020.     and    #$3e,d1
  2021.     add    d1,d0
  2022.  
  2023.     move    P60_Period(a5),d1
  2024.     tst.b    P60_VibPos(a5)
  2025.     bmi.b    .vibneg
  2026.     add    P60_vibtab(pc,d0),d1
  2027.     bra.b    P60_vib4
  2028.  
  2029. .vibneg    sub    P60_vibtab(pc,d0),d1
  2030.  
  2031. P60_vib4
  2032.     move    d1,6(a4)
  2033.     move.b    P60_VibCmd(a5),d0
  2034.     lsr.b    #2,d0
  2035.     and    #$3c,d0
  2036.     add.b    d0,P60_VibPos(a5)
  2037.     bra    P60_contfxdone
  2038.     endc
  2039.  
  2040.     ifne    P60_tre
  2041. P60_tremo
  2042.     move    #$f00,d0
  2043.     move    P60_TreCmd(a5),d1
  2044.     and    d1,d0
  2045.     lsr    #2,d0
  2046.     
  2047.     lsr    #1,d1
  2048.     and    #$3e,d1
  2049.     add    d1,d0
  2050.  
  2051.     move    P60_Volume(a5),d1
  2052.     tst.b    P60_TrePos(a5)
  2053.     bmi.b    .treneg
  2054.     add    P60_vibtab(pc,d0),d1
  2055.     cmp    #64,d1
  2056.     ble.b    P60_tre4
  2057.     moveq    #64,d1
  2058.     bra.b    P60_tre4
  2059.  
  2060. .treneg    sub    P60_vibtab(pc,d0),d1
  2061.     bpl.b    P60_tre4
  2062.     moveq    #0,d1
  2063. P60_tre4
  2064.     ifeq    fade
  2065.     move    d1,8(a4)
  2066.     else
  2067.     move    d1,P60_Shadow(a5)
  2068.     endc
  2069.  
  2070.     move.b    P60_TreCmd(a5),d0
  2071.     lsr.b    #2,d0
  2072.     and    #$3c,d0
  2073.     add.b    d0,P60_TrePos(a5)
  2074.     bra    P60_contfxdone
  2075.     endc
  2076.  
  2077.     ifne    P60_vib!P60_tre
  2078. P60_vibtab    incbin    vibtab
  2079.     endc
  2080.  
  2081.     ifne    P60_il
  2082. P60_funk
  2083.     moveq    #$f,d0
  2084.     and.b    P60_Info(a5),d0
  2085.     move.b    d0,P60_Funkspd(a5)
  2086.     bra    P60_fxdone
  2087.  
  2088. P60_funk2
  2089.     moveq    #0,d0
  2090.     move.b    P60_Funkspd(a5),d0
  2091.     beq.b    P60_funkend
  2092.     move.b    P60_FunkTable(pc,d0),d0
  2093.     add.b    d0,P60_Funkoff(a5)
  2094.     bpl.b    P60_funkend
  2095.     clr.b    P60_Funkoff(a5)
  2096.  
  2097.     move.l    P60_Sample(a5),a1
  2098.     move.l    P60_RepeatOffset(a1),d1
  2099.     move    P60_RepeatLength(a1),d0
  2100.     add.l    d0,d0
  2101.     add.l    d1,d0
  2102.     move.l    P60_Wave(a5),a0
  2103.     addq.l    #1,a0
  2104.     cmp.l    d0,a0
  2105.     blo.b    P60_funkok
  2106.     move.l    d1,a0
  2107. P60_funkok
  2108.     move.l    a0,P60_Wave(a5)
  2109.     not.b    (a0)
  2110. P60_funkend
  2111.     rts
  2112.  
  2113. P60_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2114.     endc
  2115.  
  2116. P60_jtab
  2117.     dc    P60_fxdone-*
  2118.     dc    P60_fxdone-*
  2119.     dc    P60_fxdone-*
  2120.  
  2121.     ifne    P60_tp
  2122.     dc    P60_settoneport-*
  2123.     else
  2124.     dc    P60_fxdone-*
  2125.     endc
  2126.  
  2127.     ifne    P60_vib
  2128.     dc    P60_vibrato-*
  2129.     else
  2130.     dc    P60_fxdone-*
  2131.     endc
  2132.  
  2133.     ifne    P60_tpvs
  2134.     dc    P60_toponochange-*
  2135.     else
  2136.     dc    P60_fxdone-*
  2137.     endc
  2138.  
  2139.     dc    P60_fxdone-*
  2140.  
  2141.     ifne    P60_tre
  2142.     dc    P60_settremo-*
  2143.     else
  2144.     dc    P60_fxdone-*
  2145.     endc
  2146.  
  2147.     dc    P60_fxdone-*
  2148.  
  2149.     ifne    P60_sof
  2150.     dc    P60_sampleoffse-*
  2151.     else
  2152.     dc    P60_fxdone-*
  2153.     endc
  2154.     dc    P60_fxdone-*
  2155.  
  2156.     ifne    P60_pj
  2157.     dc    P60_posjmp-*
  2158.     else
  2159.     dc    P60_fxdone-*
  2160.     endc
  2161.  
  2162.     ifne    P60_vl
  2163.     dc    P60_volum-*
  2164.     else
  2165.     dc    P60_fxdone-*
  2166.     endc
  2167.  
  2168.     ifne    P60_pb
  2169.     dc    P60_pattbreak-*
  2170.     else
  2171.     dc    P60_fxdone-*
  2172.     endc
  2173.  
  2174.     ifne    P60_ec
  2175.     dc    P60_ecommands-*
  2176.     else
  2177.     dc    P60_fxdone-*
  2178.     endc
  2179.     
  2180.     ifne    P60_sd
  2181.     dc    P60_cspeed-*
  2182.     else
  2183.     dc    P60_fxdone-*
  2184.     endc
  2185.  
  2186. P60_dmason
  2187.     ifeq    system
  2188.     tst.b    $bfdd00
  2189.     move.l    a0,-(sp)
  2190.     move.l    P60_vektori(pc),a0
  2191.     move.l    P60_intaddr(pc),(a0)
  2192.     move.l    (sp)+,a0
  2193.     move    P60_dma(pc),$dff096
  2194.     move    #$2000,$dff09c
  2195.     move.b    #$19,$bfde00
  2196.     rte
  2197.  
  2198.     else
  2199.     move    P60_dma(pc),$96(a6)
  2200.     addq    #1,P60_server-P60_cn(a3)
  2201.     move.l    P60_craddr(pc),a0
  2202.     move.b    #$19,(a0)
  2203.     bra    P60_ohi
  2204.     endc
  2205.  
  2206.  
  2207. P60_setrepeat
  2208.     ifeq    system
  2209.     tst.b    $bfdd00
  2210.     movem.l    a0/a1,-(sp)
  2211.     lea    $dff0a0,a1
  2212.     else
  2213.     lea    $a0(a6),a1
  2214.     endc
  2215.  
  2216.     move.l    P60_Sample+P60_temp0(pc),a0
  2217.     addq.l    #6,a0
  2218.     move.l    (a0)+,(a1)+
  2219.     move    (a0),(a1)
  2220.  
  2221.     ifgt    channels-1
  2222.     move.l    P60_Sample+P60_temp1(pc),a0
  2223.     addq.l    #6,a0
  2224.     move.l    (a0)+,12(a1)
  2225.     move    (a0),16(a1)
  2226.     endc
  2227.     
  2228.     ifgt    channels-2
  2229.     move.l    P60_Sample+P60_temp2(pc),a0
  2230.     addq.l    #6,a0
  2231.     move.l    (a0)+,28(a1)
  2232.     move    (a0),32(a1)
  2233.     endc
  2234.  
  2235.     ifgt    channels-3
  2236.     move.l    P60_Sample+P60_temp3(pc),a0
  2237.     addq.l    #6,a0
  2238.     move.l    (a0)+,44(a1)
  2239.     move    (a0),48(a1)
  2240.     endc
  2241.  
  2242.     ifne    system
  2243.     clr    P60_server-P60_cn(a3)
  2244.     move.l    P60_craddr+4(pc),a0
  2245.     move.b    P60_tlo(pc),(a0)
  2246.     move.b    P60_thi(pc),$100(a0)
  2247.     bra    P60_ohi
  2248.     else
  2249.  
  2250.     move    #$2000,-8(a1)
  2251.     ifne    CIA
  2252.     move.l    P60_vektori(pc),a0
  2253.     move.l    P60_tintti(pc),(a0)
  2254.     move.b    P60_tlo(pc),$bfd400
  2255.     move.b    P60_thi(pc),$bfd500
  2256.     endc
  2257.  
  2258.     movem.l    (sp)+,a0/a1
  2259.     rte
  2260.     endc
  2261.  
  2262. P60_temp0
  2263.     dcb.b    Channel_Block_SIZE-2
  2264.     dc    1
  2265. P60_temp1
  2266.     dcb.b    Channel_Block_SIZE-2
  2267.     dc    2
  2268. P60_temp2
  2269.     dcb.b    Channel_Block_SIZE-2
  2270.     dc    4
  2271. P60_temp3
  2272.     dcb.b    Channel_Block_SIZE-2
  2273.     dc    8
  2274.  
  2275. P60_cn    dc    0
  2276. P60_dma    dc    $8200
  2277. P60_rowpos
  2278.     dc    0
  2279. P60_speed
  2280.     dc    0
  2281. P60_speed2
  2282.     dc    0
  2283. P60_speedis1
  2284.     dc    0
  2285. P60_spos
  2286.     dc.l    0
  2287.     ifeq    system
  2288. P60_vektori
  2289.     dc.l    0
  2290.     endc
  2291. P60_ofilter
  2292.     dc    0
  2293.     ifne    CIA
  2294. P60_tintti
  2295.     dc.l    0
  2296. P60_thi    dc.b    0
  2297. P60_tlo    dc.b    0
  2298. P60_thi2
  2299.     dc.b    0
  2300. P60_tlo2
  2301.     dc.b    0
  2302. P60_timer
  2303.     dc.l    0
  2304.     endc
  2305.  
  2306.     ifne    P60_pl
  2307. P60_plcount
  2308.     dc    0
  2309. P60_plflag
  2310.     dc    0
  2311. P60_plreset
  2312.     dc    0
  2313. P60_plrowpos
  2314.     dc    0
  2315. P60_looppos
  2316.     dcb.b    12*channels
  2317.     endc
  2318.  
  2319.     ifne    P60_pde
  2320. P60_pdelay
  2321.     dc    0
  2322.     endc
  2323. P60_Samples
  2324.     dcb.b    16*31
  2325. P60_positionbase
  2326.     dc.l    0
  2327. P60_possibase
  2328.     dc.l    0
  2329. P60_patternbase
  2330.     dc.l    0
  2331. P60_intaddr
  2332.     dc.l    0
  2333. P60_oldlev6
  2334.     dc.l    0
  2335.     ifne    system
  2336. P60_server
  2337.     dc    0
  2338. P60_miscbase    dc.l    0
  2339. P60_audioopen    dc.b    0
  2340. P60_sigbit    dc.b    -1
  2341. P60_ciares    dc.l    0
  2342. P60_craddr    dc.l    0,0,0
  2343.  
  2344. P60_dat        dc    $f00
  2345. P60_timerinterrupt
  2346.         dc    0,0,0,0,127
  2347. P60_timerdata    dc.l    0,0,0
  2348.  
  2349. P60_allocport    dc.l    0,0
  2350.         dc.b    4,0
  2351.         dc.l    0
  2352.         dc.b    0,0
  2353.         dc.l    0
  2354. P60_reqlist    dc.l    0,0,0
  2355.         dc.b    5,0
  2356. P60_allocreq    dc.l    0,0
  2357.         dc    127
  2358.         dc.l    0
  2359. P60_portti    dc.l    0
  2360.         dc    68
  2361.         dc.l    0,0,0
  2362.         dc    0
  2363. P60_reqdata    dc.l    0
  2364.         dc.l    1,0,0,0,0,0,0
  2365.         dc    0
  2366. P60_audiodev    dc.b    'audio.device',0
  2367.  
  2368. P60_cianame    dc.b    'ciax.resource',0
  2369. P60_timeropen    dc.b    0
  2370. P60_timerint    dc.b    'P60TimerInterrupt',0
  2371.     endc
  2372. P60_etu
  2373.  
  2374. ******** END OF BINARY FILE **************
  2375.  
  2376.     section    chip,data_c
  2377. P60_data    incbin    "ram:P60.pid.alkumusa.s"
  2378.  
  2379.     section    smp,bss_c
  2380. samples    ;ds.b    $32600        ;uncomment if you have packed samples
  2381.                 ;and insert sample buffer length
  2382.